package com.software.sqlite.task;

import com.software.sqlite.service.impl.TbMovieUserBillService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @Description
 * @ClassName ApiTask
 * @Author darren
 * @date 2023.04.07 15:23
 */
@Component
@EnableScheduling
@Slf4j
public class FlowDataScheduledTask {

    @Value("${task.flowData}")
    private boolean flowData;

    @Resource
    private TbMovieUserBillService movieUserBillService;

    public static boolean isRunning=false;

    //每5分钟执行一次
    @Scheduled(fixedRate = 5*60*1000)
    private void scheduledTask() {
        if(flowData){
            log.info("FlowDataScheduledTask scheduledTask...");
            movieUserBillService.autoRecharge();
        }
    }

}
